package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppLoginLog;
import com.ep.modules.app.service.AppLoginLogService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/login_log")
public class AppLoginLogController {
    @Autowired
    private AppLoginLogService appLoginLogService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appLoginLogService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppLoginLog apploginlog = appLoginLogService.getById(id);
        return R.ok().put("apploginlog", apploginlog);
    }

    @SysLog("保存AppLoginLog")
    @PostMapping("/save")
    public R save(@RequestBody AppLoginLog apploginlog) {
        ValidatorUtils.validateEntity(apploginlog);
        appLoginLogService.save(apploginlog);
        return R.ok();
    }

    @SysLog("修改AppLoginLog")
    @PostMapping("/update")
    public R update(@RequestBody AppLoginLog apploginlog) {
        ValidatorUtils.validateEntity(apploginlog);
        appLoginLogService.update(apploginlog);
        return R.ok();
    }

    @SysLog("删除AppLoginLog")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appLoginLogService.deleteBatch(ids);
        return R.ok();
    }
}